Skip to content

[Repo Assist] Fix Markdown.ToMd: Emphasis serialised as bold; ordered list 0-indexed#1102

Merged
nojaf merged 4 commits intomainfrom
repo-assist/fix-tomd-emphasis-ordered-2026-03-18-bcd822ad491317cc
Mar 18, 2026
Merged

[Repo Assist] Fix Markdown.ToMd: Emphasis serialised as bold; ordered list 0-indexed#1102
nojaf merged 4 commits intomainfrom
repo-assist/fix-tomd-emphasis-ordered-2026-03-18-bcd822ad491317cc

Conversation

@github-actions
Copy link
Contributor

🤖 This is an automated PR from Repo Assist.

Two bugs found and fixed in Markdown.ToMd (the MarkdownUtils.fs serialiser):

Bugs fixed

1. Emphasis serialised as bold (**...**) instead of italic (*...*)

formatSpan had a copy-paste error:

// Before (wrong — same as Strong)
| Emphasis(body, _) -> "**" + formatSpans ctx body + "**"

// After (correct)
| Emphasis(body, _) -> "*" + formatSpans ctx body + "*"

Round-trip before fix: *italic***italic** (text becomes bold)

2. Ordered list items use 0-based numbering with no period

formatParagraph used List.indexed (0-based) and formatted as $"%i{n} ":

// Before (wrong — "0 first", "1 second", ...)
yield $"%i{n} " + line

// After (correct — "1. first", "2. second", ...)
yield $"%i{n + 1}. " + line

Round-trip before fix: 1. first\n2. second0 first\n1 second

Tests added

Four new regression tests in tests/FSharp.Markdown.Tests/Markdown.fs:

  • ToMd preserves emphasis (italic) text
  • ToMd preserves emphasis distinct from strong
  • ToMd preserves an ordered list with correct numbering
  • ToMd ordered list does not use zero-based numbering

Test Status

  • dotnet build FSharp.Formatting.sln --configuration Release — succeeded (1 pre-existing FS0760 warning)
  • dotnet test FSharp.Formatting.sln --configuration Release --no-build — all 527 tests pass (281 Markdown, 30 CodeFormat, 8 fsdocs-tool, 120 Literate, 88 ApiDocs)
  • dotnet fantomas src/FSharp.Formatting.Markdown/MarkdownUtils.fs tests/FSharp.Markdown.Tests/Markdown.fs --check — no formatting changes needed

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

Two bugs in MarkdownUtils.fs formatSpan/formatParagraph:

1. Emphasis (italic) was serialised as **...** (bold) instead of *...*,
   causing round-trip loss: *italic* → **italic**

2. Ordered list items used 0-based indexing with no period:
   "0 first", "1 second" instead of "1. first", "2. second"

Fix both and add four regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review March 18, 2026 14:04
@dsyme
Copy link
Contributor

dsyme commented Mar 18, 2026

@nojaf Nice fix by the bot!

@nojaf
Copy link
Collaborator

nojaf commented Mar 18, 2026

/repo-assist release notes should always have a link to either a github issue or PR. Right now end-users can't piece your fix together with anything.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: 8dd8f8a

Generated by Repo Assist

@github-actions
Copy link
Contributor Author

🤖 This is an automated response from Repo Assist.

Good catch, @nojaf! I've pushed a fix to this PR — all three entries in the [Unreleased] section that were missing links now have them:

  • IndirectImage crash fix → #1094
  • Emphasis serialisation fix → #1102
  • Ordered list numbering fix → #1102

I'll make sure every future release note entry includes a link from the start.

Generated by Repo Assist for issue #1102 ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

@nojaf nojaf enabled auto-merge (squash) March 18, 2026 15:47
@nojaf nojaf merged commit 0b027d4 into main Mar 18, 2026
4 checks passed
@nojaf nojaf deleted the repo-assist/fix-tomd-emphasis-ordered-2026-03-18-bcd822ad491317cc branch March 18, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants